﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>加载MapGIS地图文档服务</title>
        <script include="jquery" src="./static/libs/include-lib-local.js"></script>
        <script src="./static/libs/include-openlayers-local.js"></script>
        <script type="text/javascript">
            //地图初始化函数
            function init() {
                var extent = [634883.45517486, 3423051.6221381, 643377, 3431937.8]
                var projection = new ol.proj.Projection({ units: ol.proj.Units.METERS, extent: extent })
                //中心点
                var center = ol.extent.getCenter(extent)
                var { ip, port } = window.webclient
                //地图文档服务的显示名称
                var name = 'MapGIS IGS MapDocLayer'
                //地图文档名称
                var docname = 'SampleDoc'
                var mapDocLayer = new Zondy.Map.Doc(name, docname, {
                    ip: `${ip}`,
                    port: `${port}`, //访问IGServer的端口号，.net版为6163，Java版为8089
                    extent: extent,
                })
                //初始化地图容器
                var map = new ol.Map({
                    //目标DIV
                    target: 'mapCon',
                    //将图层添加到地图容器
                    layers: [mapDocLayer],
                    view: new ol.View({
                        projection: projection,
                        center: center,
                        //最大显示级数
                        maxZoom: 5,
                        //最小显示级数
                        minZoom: 1,
                        //当前显示级数
                        zoom: 3,
                    }),
                })
            }
        </script>
    </head>

    <body onload="init();">
        <!--地图显示-->
        <div id="mapCon" style="width: 100%; height: 95%; position: absolute;"></div>
    </body>
</html>
